﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Core.Dtos
{
    public static class SettingDtoExtensions
    {
        public static string GetValue(this IEnumerable<SettingDto> list, string name)
        {
            var setting = list.Where(x => x.Name.Equals(name)).FirstOrDefault();
            if (setting != null)
                return setting.Value;
            else
                throw new Exception(string.Format("Setting {0} was not found", name));
        }
    }
}
